Change in openvpn[master]: iservice: fix buffer size in call to FormatMessage
A message that is not in the archive (sent off-list or not yet received): gerrit.1763661267000.I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
to review the following change.
Change subject: iservice: fix buffer size in call to FormatMessage
......................................................................
iservice: fix buffer size in call to FormatMessage
The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer.
---
M src/openvpnserv/interactive.c
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/1387/1
src/openvpnserv/interactive.c +2 -3
@@ -734,9 +734,8 @@ err_str =L"Unknown Win32 Error" ; -if (FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM - |FORMAT_MESSAGE_ARGUMENT_ARRAY , -NULL , err,0 , buf,sizeof (buf),NULL )) +if (FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM , +NULL , err,0 , buf,_countof (buf),NULL )) { err_str = buf; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Gerrit-Change-Number: 1387
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
to look at the new patch set (#2).
Change subject: iservice: fix buffer size in call to FormatMessage
......................................................................
iservice: fix buffer size in call to FormatMessage
The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer.
While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter.
---
M src/openvpnserv/interactive.c
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/1387/2
src/openvpnserv/interactive.c +2 -3
@@ -734,9 +734,8 @@ err_str =L"Unknown Win32 Error" ; -if (FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM - |FORMAT_MESSAGE_ARGUMENT_ARRAY , -NULL , err,0 , buf,sizeof (buf),NULL )) +if (FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM , +NULL , err,0 , buf,_countof (buf),NULL )) { err_str = buf; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Gerrit-Change-Number: 1387
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: d12fk, plaisthos, selvanair, stipa.
cron2 has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email )
Change subject: iservice: fix buffer size in call to FormatMessage
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Gerrit-Change-Number: 1387
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sat, 22 Nov 2025 15:54:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v2 1/1 iservice: fix buffer size in call to FormatMessage
In reply to a message not in the archiveFrom: Heiko Hund <[email protected]...>
The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer.
While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpnserv/interactive.c +2 -3
@@ -734,9 +734,8 @@ err_str =L"Unknown Win32 Error" ; -if (FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM - |FORMAT_MESSAGE_ARGUMENT_ARRAY , -NULL , err,0 , buf,sizeof (buf),NULL )) +if (FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM , +NULL , err,0 , buf,_countof (buf),NULL )) { err_str = buf; }
[Openvpn-devel] [PATCH applied] Re: iservice: fix buffer size in call to FormatMessage
I have not actually tested this (beyond "does it compile") but reading the docs about FormatMessageW() and the overall other code, this looks very correct.
Your patch has been applied to the master branch.
It might be applicable to release/2.6, but we use a "TCHAR" there, not a WCHAR - so that code might just be correct, or not.
commit b39bed539f218f6165d79224adbc343a63a4514d
Author: Heiko Hund Date: Sat Nov 22 16:55:00 2025 +0100
iservice: fix buffer size in call to FormatMessage
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34583.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: iservice: fix buffer size in call to FormatMessage
......................................................................
iservice: fix buffer size in call to FormatMessage
The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer.
While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34583.html
---
M src/openvpnserv/interactive.c
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/1387/3
src/openvpnserv/interactive.c +2 -3
@@ -734,9 +734,8 @@ err_str =L"Unknown Win32 Error" ; -if (FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM - |FORMAT_MESSAGE_ARGUMENT_ARRAY , -NULL , err,0 , buf,sizeof (buf),NULL )) +if (FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM , +NULL , err,0 , buf,_countof (buf),NULL )) { err_str = buf; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Gerrit-Change-Number: 1387
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email )
Change subject: iservice: fix buffer size in call to FormatMessage
......................................................................
iservice: fix buffer size in call to FormatMessage
The buffer size is to be given in # of TCHARs according to the docs. In this case that is the number of WCHARs in the buffer.
While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just to make things a bit shorter.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34583.html
---
M src/openvpnserv/interactive.c
1 file changed, 2 insertions(+), 3 deletions(-)
src/openvpnserv/interactive.c +2 -3
@@ -734,9 +734,8 @@ err_str =L"Unknown Win32 Error" ; -if (FormatMessage (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM - |FORMAT_MESSAGE_ARGUMENT_ARRAY , -NULL , err,0 , buf,sizeof (buf),NULL )) +if (FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM , +NULL , err,0 , buf,_countof (buf),NULL )) { err_str = buf; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1387?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Gerrit-Change-Number: 1387
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>